package ipmss.entity.planning;

import ipmss.entity.authorities.User;
import ipmss.entity.authorities.UserProfile;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;

// TODO: Auto-generated Javadoc
/**
 * The Class Project.
 *
 * @author Michał Czarnik
 */
@Entity
public class Project implements Serializable,Cloneable
{
    
    /** The id. */
    @Id
    @GeneratedValue
    private int id;
    
    /** The schedule. */
    @OneToOne(fetch=FetchType.EAGER,cascade=CascadeType.ALL)
    private Task schedule;
    
    /** The users. */
    @ManyToMany(fetch = FetchType.LAZY)
    private List<User> users =  new ArrayList<User>();
    
    /** The calendar. */
    @ManyToOne(cascade = {CascadeType.ALL})
    private Calendar calendar;
    
    /** The name. */
    private String name;

    /**
     * Gets the users.
     *
     * @return the users
     */
    public List<User> getUsers()
    {
	return users;
    }

    /**
     * Sets the users.
     *
     * @param users the new users
     */
    public void setUsers(List<User> users)
    {
	this.users = users;
    }

    /**
     * Gets the schedule.
     *
     * @return the schedule
     */
    public Task getSchedule()
    {
	return schedule;
    }

    /**
     * Sets the schedule.
     *
     * @param schedule the new schedule
     */
    public void setSchedule(Task schedule)
    {
	this.schedule = schedule;
    }
    
    /**
     * Adds the user.
     *
     * @param user the user
     */
    public void addUser(User user)
    {
	users.add(user);
    }

    /**
     * Gets the name.
     *
     * @return the name
     */
    public String getName()
    {
	return name;
    }

    /**
     * Sets the name.
     *
     * @param name the new name
     */
    public void setName(String name)
    {
	this.name = name;
    }

    /**
     * Gets the id.
     *
     * @return the id
     */
    public int getId()
    {
	return id;
    }

    /**
     * Sets the id.
     *
     * @param id the new id
     */
    public void setId(int id)
    {
	this.id = id;
    }

    /**
     * Gets the calendar.
     *
     * @return the calendar
     */
    public Calendar getCalendar()
    {
	return calendar;
    }

    /**
     * Sets the calendar.
     *
     * @param calendar the new calendar
     */
    public void setCalendar(Calendar calendar)
    {
	this.calendar = calendar;
    } 
   

}
